goog.provide('dkpoints.utils');

goog.require('goog.dom');
goog.require('soy');

// Dynamically load a module's CSS file
dkpoints.utils.loadCSS = function(strCSSName)
{
  // Make sure it's not already loaded.
  if(dkpoints.utils.loadedCSS_.indexOf(strCSSName) == -1)
  {
    var head = goog.dom.$$("head")[0];
    var props = {rel: 'stylesheet', href: '/stylesheets/' + strCSSName + '.css'};
    var newCSS = goog.dom.createDom('link', props);
    head.appendChild(newCSS);
    
    // Add the module name to the list
    dkpoints.utils.loadedCSS_.push(strCSSName);
  }
}

// Item Quality
dkpoints.utils.IQuality = [];
  dkpoints.utils.IQuality[0] = "poor";
  dkpoints.utils.IQuality[1] = "common";
  dkpoints.utils.IQuality[2] = "uncommon";
  dkpoints.utils.IQuality[3] = "rare";
  dkpoints.utils.IQuality[4] = "epic";
  dkpoints.utils.IQuality[5] = "legendary";

// List of loaded CSS modules
dkpoints.utils.loadedCSS_ = [];

/**
 * Return a wowhead item link
 * @param {number} itemID The Item ID of the item.
 * @return {string}
 */
dkpoints.utils.getWowheadLink = function(itemID) {
  return "http://www.wowhead.com/item=" + itemID;
};

/**
 * Return an armory item icon image URL
 * @param {string} texture
 * @return {string}
 */
dkpoints.utils.getArmoryIconSrc = function(texture) {
  return "http://www.wowarmory.com/wow-icons/_images/64x64/" + texture + ".jpg";
};